package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itheima.dao.AccountDao;
import com.itheima.domain.Account;
import com.itheima.exception.BusinessException;
import com.itheima.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.io.IOException;
import java.util.List;

/**
 * @author xiangjun.deng
 * email 17670934918dxj@sina.com
 * @date 2021/8/20 15:01
 * @desc
 */
@Service
@Transactional
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;
    @Override
    public void save(Account account) throws IOException {
        accountDao.save(account);
        System.out.println("com.itheima.dao.AccountDao.save... running");

    }

    @Override
    public PageInfo<Account> findAll( Integer page,Integer size) {
        PageHelper.startPage(page,size);
        List<Account> userList = accountDao.getAll();
        return new PageInfo<Account>(userList);
    }
}
